<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>解构赋值</title>
</head>
<body>
<script type="text/javascript">
    //取对象
    let obj = {
        id:"1",
        name:"tom",
        age:'18'
    }
    //ES5方式取出对象赋值
    let id5 = obj.id;
    let name5 = obj.name;
    console.log(id5,name5);
    //ES6,注意这里的id,name是与对象中的属性名对应的
    //这里也是完全解构
    //let {id,name,age} = obj;
    //console.log(id,name,age)
    //使用剩余参数来取，不完全解构
    let {id,...values} = obj;
    console.log(values);
    //===========================================
    //取数组
    let arr = [1,2,34,5];
    let [a,b,...c] = arr;
    console.log(a,b,c);
</script>
</body>
</html>